/*Author: Rony Lahav (ID:043489889)*/

import java.util.Collection;
import java.util.TreeMap;


public class AVManagerReg  extends AVManager implements Runnable{

	public void run() {
		do {
			// Get my main SN in order to send it an AV message
			DBTuple snTuple = final_project.getMyMainSN();
			String AVmsg="";
			if (snTuple!=null && snTuple.getStatus() && !final_project.isShutDown()){	//if SN is online
				AVmsg=createAVMessage();
				sendAVToOneTuple(snTuple,AVmsg);
			}
			try{
				if (!final_project.isShutDown()) {
					// Sleep until next AV frequency
					Thread.sleep(final_project.frequency);
				}
			}
			catch (InterruptedException e){}
		} while (!final_project.isShutDown() && !final_project.inFallBackMode);
	}
}
